#ifndef _PATH_H_
#define _PATH_H_
#include "cocos2d.h"
#include "CMemoryFile.h"

using namespace cocos2d;
using namespace io;
using namespace std;

namespace fireplane
{
	enum _e_bezier_point{
		e_bezier_point_start = 0,
		e_bezier_point_ctrl,
		e_bezier_point_end,
		e_bezier_point_max
	};

	typedef struct  _Bezier
	{
		CCPoint  point[e_bezier_point_max];
	}Bezier;

	typedef list<Bezier*> BezierList;
	typedef map<string,BezierList*> PathMap;

	class Path 
	{
	public:
		static Path* getPath();
		void loadPath(int level);
		void _loadPathFile(CMemoryFile* file);
		BezierList* getBezierList(string name);

		BezierList* _loadNPCPathFile(int level,string npc_name);
		BezierList* getNPCPath(int level,string npc_name);

		CCPoint hornbez2(CCPoint *point, float t);
	private:
		Path();
		~Path();

		static Path* _s_Path;
		PathMap _all_path_map;
		PathMap _all_path_cache;
	};

}

#endif